//
//  BLUserManager.m
//  Byelone
//
//  Created by Qi Liu on 2021/1/31.
//

#import "BLUserManager.h"

static BLUserManager * instance = nil;

@implementation BLUserManager

+(instancetype)shareUser{
    static dispatch_once_t onceToken;
    dispatch_once(&onceToken, ^{
        instance = [[BLUserManager alloc]init];
    });
    return instance;
}

-(void)setAliOssConfig:(NSDictionary *)dic{
    self.AccessKeyId = [dic objectForKey:@"AccessKeyId"];
    self.AccessKeySecret = [dic objectForKey:@"AccessKeySecret"];
    self.SecurityToken = [dic objectForKey:@"SecurityToken"];
}

/*
 * 登录步骤
 */
- (NSString *)userPpu
{
    NSUserDefaults *prefs = [NSUserDefaults standardUserDefaults];
    return [prefs objectForKey:K_Login_Ppu];
}
- (void)setUserPpu:(NSString *)userPpu
{
    NSUserDefaults *prefs = [NSUserDefaults standardUserDefaults];
    [prefs setObject:userPpu forKey:K_Login_Ppu];
    [prefs synchronize];
}

/*
 * 用户登录Token
 */
- (NSString *)registerStep
{
    NSUserDefaults *prefs = [NSUserDefaults standardUserDefaults];
    return [prefs objectForKey:K_Login_RegisterStep];
}
- (void)setRegisterStep:(NSString *)registerStep
{
    NSUserDefaults *prefs = [NSUserDefaults standardUserDefaults];
    [prefs setObject:registerStep forKey:K_Login_RegisterStep];
    [prefs synchronize];
}

/*
 * 用户登录手机号
 */
- (NSString *)phone
{
    NSUserDefaults *prefs = [NSUserDefaults standardUserDefaults];
    return [prefs objectForKey:K_Login_Phone];
}
- (void)setPhone:(NSString *)phone
{
    NSUserDefaults *prefs = [NSUserDefaults standardUserDefaults];
    [prefs setObject:phone forKey:K_Login_Phone];
    [prefs synchronize];
}
@end
